home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 17.6 KB | 816 lines | [TEXT/MPS ] |
- // UDemoDialogs.h
- // Copyright © 1988-96 by Apple Computer, Inc. All rights reserved.
-
- #ifndef __UDEMODIALOGS__
- #define __UDEMODIALOGS__
-
- // MacApp
-
- #ifndef __MACAPPTYPES__
- #include "MacAppTypes.h"
- #endif
-
- #ifndef __UADORNERS__
- #include "UAdorners.h"
- #endif
-
- #ifndef __UAPPLICATION__
- #include "UApplication.h"
- #endif
-
- #ifndef __UBEHAVIOR__
- #include "UBehavior.h"
- #endif
-
- #ifndef __UCOMMAND__
- #include "UCommand.h"
- #endif
-
- #ifndef __UCCOMMANDHANDLER__
- #include "UCommandHandler.h"
- #endif
-
- #ifndef __UCONTROL__
- #include "UControl.h"
- #endif
-
- #ifndef __UDIALOG__
- #include "UDialog.h"
- #endif
-
- #ifndef __UDOCUMENT__
- #include "UDocument.h"
- #endif
-
- #ifndef __UEVENT__
- #include "UEvent.h"
- #endif
-
- #ifndef __UEVENTHANDLER__
- #include "UEventHandler.h"
- #endif
-
- #ifndef __UFAILURE__
- #include "UFailure.h"
- #endif
-
- #ifndef __UFILE__
- #include "UFile.h"
- #endif
-
- #ifndef __UGEOMETRY__
- #include "UGeometry.h"
- #endif
-
- #ifndef __UGRIDVIEW__
- #include "UGridView.h"
- #endif
-
- #ifndef __ULIST__
- #include "UList.h"
- #endif
-
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- #ifndef __UMACAPPUTILITIES__
- #include "UMacAppUtilities.h"
- #endif
-
- #ifndef __UMENUMGR__
- #include "UMenuMgr.h"
- #endif
-
- #ifndef __UOBJECT__
- #include "UObject.h"
- #endif
-
- #ifndef __UPATCH__
- #include "UPatch.h"
- #endif
-
- #ifndef __UPOPUP__
- #include "UPopup.h"
- #endif
-
- #ifndef __UPRINTHANDLER__
- #include "UPrintHandler.h"
- #endif
-
- #ifndef __UPRINTING__
- #include "UPrinting.h"
- #endif
-
- #ifndef __USCROLLER__
- #include "UScroller.h"
- #endif
-
- #ifndef __USTREAM__
- #include "UStream.h"
- #endif
-
- #ifndef __UTEVIEW__
- #include "UTEView.h"
- #endif
-
- #ifndef __UVIEW__
- #include "UView.h"
- #endif
-
- #ifndef __UWINDOW__
- #include "UWindow.h"
- #endif
-
- // Toolbox
-
- #ifndef __ALIASES__
- #include <Aliases.h>
- #endif
-
- #ifndef __APPLEEVENTS__
- #include <AppleEvents.h>
- #endif
-
- #ifndef __BALLOONS__
- #include <Balloons.h>
- #endif
-
- #ifndef __CONTROLS__
- #include <Controls.h>
- #endif
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __EDITIONS__
- #include <Editions.h>
- #endif
-
- #ifndef __EVENTS__
- #include <Events.h>
- #endif
-
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
- #ifndef __MEMORY__
- #include <Memory.h>
- #endif
-
- #ifndef __MENUS__
- #include <Menus.h>
- #endif
-
- #ifndef __OSUTILS__
- #include <OSUtils.h>
- #endif
-
- #ifndef __QUICKDRAW__
- #include <Quickdraw.h>
- #endif
-
- #ifndef __SCRAP__
- #include <Scrap.h>
- #endif
-
- #ifndef __SCRIPT__
- #include <Script.h>
- #endif
-
- #ifndef __STANDARDFILE__
- #include <StandardFile.h>
- #endif
-
- #ifndef __TEXTEDIT__
- #include <TextEdit.h>
- #endif
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
-
-
- // Command numbers
- const short cMakePicture = 1000;
-
- const OSType kSignature = 'SS11'; // Application signature
- const OSType kFileType = 'SF11'; // File-type code used for document files
- // created by this application
- const short kTestWindowID = 1001; // This is passed to NewSimpleWindow as
- // the resource ID of the the WIND Resource
- // which defines the window for this
- // application's documents
-
- const short kMaxFonds = 100; // Max number of FONDs the FontList holds
- const short kMaxSizes = 30; // Max number of Font sizes the SizeList holds
-
- typedef enum
- {
- noOperator, divOperator, mulOperator, subOperator, addOperator
- } CalcOperator;
-
- typedef short FontList[kMaxFonds]; // FOND resource IDs
- typedef FontList* FontListPtr;
-
-
- // CLASS DECLARATIONS
-
- //----------------------------------------------------------------------------------------
- // class TTestApplication
- //----------------------------------------------------------------------------------------
-
- class TTestApplication : public TApplication
- {
- MA_DECLARE_CLASS;
-
- public:
-
- MenuRef fMenuRef;
-
- virtual ~TTestApplication();
- // Destructor
-
- virtual void ITestApplication();
- // Initializes the application and globals.
-
- virtual TDocument* DoMakeDocument(CommandNumber/*itsCommandNumber*/,
- TFile* /*itsFile*/ );// override
- // Overridden to do nothing since we don't have a document
-
- virtual void MakeProcedureViews(CommandNumber aCommandNumber);
-
- virtual void DoMenuCommand(CommandNumber aCommandNumber);// override
-
- virtual void DoSetupMenus(); // override
-
- protected: // the procedures to do the views by procedures!!
- virtual void MakeTemplateViews(CommandNumber aCommandNumber);
-
- virtual void MakeScrollingTest(CommandNumber aCommandNumber);
-
- virtual void MakeMonthlyDialog(CommandNumber aCommandNumber);
-
- virtual void MakeSaveDialog( CommandNumber aCommandNumber);
-
- virtual void MakeModalBeepDialog(CommandNumber aCommandNumber);
-
- virtual void MakeDialog(CommandNumber aCommandNumber);
-
- virtual void MakeBalloonWindow(CommandNumber aCommandNumber);
-
- virtual void MakeFormatDialog(CommandNumber aCommandNumber);
-
- virtual void SetupTheFontView(TDialogView* theDialog);
-
- virtual void MakePageSetupDialog(CommandNumber aCommandNumber);
-
- virtual void MakeCalculator(CommandNumber aCommandNumber);
-
- virtual void MakeHomeBrewDialog(CommandNumber aCommandNumber);
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TNumbersView
- //----------------------------------------------------------------------------------------
-
- class TNumbersView : public TView
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TNumbersView();
- // Destructor
-
- virtual void ReadFields(TStream* aStream);// override
-
- virtual void Draw(const VRect& area);
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TNumberListView
- //----------------------------------------------------------------------------------------
-
- class TNumberListView : public TTextListView
- {
- MA_DECLARE_CLASS;
-
- public:
-
- TNumberListView();
-
- virtual ~TNumberListView();
- // Destructor
-
- virtual void DoPostCreate(TDocument* itsDocument);// override
-
- virtual void BecameWindowTarget(); // override
-
- virtual void ResignedWindowTarget(); // override
-
- virtual void GetItemText( short anItem,
- CStr255& aString);// override
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TMonthlyDialog
- //----------------------------------------------------------------------------------------
-
- class TMonthlyDialog : public TDialogView
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TMonthlyDialog();
- // Destructor
-
- virtual void DoKeyEvent(TToolboxEvent* event);// override
-
- virtual void Close(); // override
-
- virtual void StuffValues();
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TModelessBeepDialog
- //----------------------------------------------------------------------------------------
-
- class TModelessBeepDialog : public TDialogView
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TModelessBeepDialog();
- // Destructor
-
- virtual void DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event); // override
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TFontListView
- //----------------------------------------------------------------------------------------
-
- class TFontListView : public TTextListView
- {
- MA_DECLARE_CLASS;
-
- public:
- FontListPtr fFontList; // font resource ids
-
- virtual void DoPostCreate(TDocument* itsDocument);// override
-
- virtual void InitFontList();
- // Build an array of ids of font resources whose names are in alphabetical order
-
- virtual ~TFontListView(); // override
- // Make sure the font list gets freed
-
- virtual void GetItemText(short anItem,
- CStr255& aString);// override
-
- virtual void SelectItem(short anItem,
- Boolean extendSelection,
- Boolean highlight,
- Boolean select);// override
-
- protected:
- virtual short FondAfter(CStr255& fontName,
- short noOfFonds);
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TSizeListView
- //----------------------------------------------------------------------------------------
-
- class TSizeListView : public TTextListView
- {
- MA_DECLARE_CLASS;
-
- public:
-
- short fFontSizeList[kMaxSizes];
- short fSelection;
- short fSelectedSize;
-
- virtual ~TSizeListView();
- // Destructor
-
- virtual void GetItemText(short anItem,
- CStr255& aString);// override
-
- virtual void InstallFontFamily(short theFondID);
-
- virtual void SelectItem(short anItem,
- Boolean extendSelection,
- Boolean highlight,
- Boolean select);// override
-
- virtual void SetNumberOfItems(short aNumber);
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TRadioIcon
- //----------------------------------------------------------------------------------------
-
- class TRadioIcon : public TIcon
- {
- MA_DECLARE_CLASS;
-
- public: // Used in the Page Setup dialog
- virtual ~TRadioIcon();
- // Destructor
-
- virtual void TrackMouse(TrackPhase aTrackPhase,
- VPoint& /*anchorPoint*/,
- VPoint& /*previousPoint*/,
- VPoint& /*nextPoint*/,
- Boolean /*mouseDidMove*/);// override
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TPageSetupDialog
- //----------------------------------------------------------------------------------------
-
- class TPageSetupDialog : public TDialogView
- {
- MA_DECLARE_CLASS;
-
- public:
-
- VHSelect fOrientation; // Vertical or Horizontal printing orientation
- TCheckBox* fTallAdjusted; // Convenient reference to a subview
- TRadioIcon* fVerticalOrientation; // Convenient reference to a subview
- TRadioIcon* fHorizontalOrientation; // Convenient reference to a subview
-
- TPageSetupDialog();
- // Constructor
- virtual ~TPageSetupDialog();
- // Destructor
-
- virtual void DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event); // override
-
- virtual void DoPostCreate(TDocument* itsDocument);// override
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TArrowsControl
- //----------------------------------------------------------------------------------------
-
- class TArrowsControl : public TPicture
- {
- MA_DECLARE_CLASS;
-
- public:
- long fLastChange; // tick count of last call to DoChoice
-
- TArrowsControl();
- // Constructor
- virtual ~TArrowsControl();
- // Destructor
-
- virtual void TrackMouse(TrackPhase aTrackPhase,
- VPoint& /*anchorPoint*/,
- VPoint& /*previousPoint*/,
- VPoint& nextPoint,
- Boolean /*mouseDidMove*/);// override
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TSwallowBehavior
- //----------------------------------------------------------------------------------------
-
- class TSwallowBehavior : public TBehavior
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TSwallowBehavior();
- // Destructor
-
- virtual Boolean DoToolboxEvent(TToolboxEvent* event);
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TChangeBehavior
- //----------------------------------------------------------------------------------------
-
- class TChangeBehavior : public TBehavior
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TChangeBehavior();
- // Destructor
-
- virtual void DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event); // override
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TUpdateBehavior
- //----------------------------------------------------------------------------------------
-
- class TUpdateBehavior : public TBehavior
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TUpdateBehavior();
- // Destructor
-
- virtual void DoBehaviorUpdate(ChangeID theChange,
- TObject* changedObject,
- TObject* changedBy,
- TDependencySpace* dependencySpace);/* override */
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TTemperatureCluster
- //----------------------------------------------------------------------------------------
-
- class TTemperatureCluster : public TCluster
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TTemperatureCluster();
- // Destructor
-
- virtual void DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event); // override
-
- virtual long GetValue();
-
- virtual void SetValue(long newValue,
- Boolean redraw);
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TTemperatureConversionCluster
- //----------------------------------------------------------------------------------------
-
- class TTemperatureConversionCluster : public TCluster
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TTemperatureConversionCluster();
- // Destructor
-
- virtual void DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event); // override
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TSlider
- //----------------------------------------------------------------------------------------
-
- class TSlider : public TPicture
- {
- MA_DECLARE_CLASS;
-
- public:
-
- short fValue;
- PicHandle fKnobPicture;
- CRect fKnobRect;
- short fMinTop;
- short fMaxTop;
-
- TSlider();
- // Constructor
- virtual ~TSlider();
- // Destructor
-
- virtual void DoPostCreate(TDocument* itsDocument);// override
-
- virtual Boolean ContainsMouse(const VPoint& theMouse);// override
-
- virtual void Draw(const VRect& area);// override
-
- virtual void DrawKnob();
-
- virtual void GetKnobRect(CRect& knobRect);
-
- virtual void TrackMouse(TrackPhase aTrackPhase,
- VPoint& anchorPoint,
- VPoint& previousPoint,
- VPoint& nextPoint,
- Boolean /*mouseDidMove*/);// override
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TSumStaticText
- //----------------------------------------------------------------------------------------
-
- class TSumStaticText : public TStaticText
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TSumStaticText();
- // Destructor
-
- virtual void Draw(const VRect& area);// override
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TCalcDialog
- //----------------------------------------------------------------------------------------
-
- class TCalcDialog : public TPicture
- {
- MA_DECLARE_CLASS;
-
- public:
-
- double fSum;
- double fArgument;
- CalcOperator fOperator;
- Boolean fDecimalPoint;
- Boolean fRestart;
-
- virtual ~TCalcDialog();
- // Destructor
-
- virtual void DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event); // override
-
- virtual void DoKeyEvent(TToolboxEvent* event); // override
-
- virtual void ClearSum();
-
- virtual double FetchValue();
-
- virtual void SetValue();
-
- virtual void TotalSum(CalcOperator newOperator);
-
- virtual void NewDigit(char theNumber);
-
- protected:
- virtual void Truncate(CStr255& theStr);
-
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TAdornmentDemo
- //----------------------------------------------------------------------------------------
-
- class TAdornmentDemo : public TView
- {
- MA_DECLARE_CLASS;
-
- public:
- TView* fTestView;
-
- TAdornmentDemo();
- // Constructor
- virtual ~TAdornmentDemo();
- // Destructor
-
- virtual void DoPostCreate(TDocument* itsDocument);// override
-
- virtual void DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event); // override
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TEmbossedFrame
- //----------------------------------------------------------------------------------------
-
- class TEmbossedFrame : public TAdorner
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TEmbossedFrame();
- // Destructor
-
- virtual void Draw(TView* itsView,
- const VRect& /*area*/);// override
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TGrayFill
- //----------------------------------------------------------------------------------------
-
- class TGrayFill : public TAdorner
- {
- MA_DECLARE_CLASS;
-
- public:
- virtual ~TGrayFill();
- // Destructor
-
- virtual void Draw(TView* itsView,
- const VRect& /*area*/);// override
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TEtchedFrame
- //----------------------------------------------------------------------------------------
-
- class TEtchedFrame : public TAdorner
- {
- MA_DECLARE_CLASS;
-
- public:
- CPoint fInset;
-
- TEtchedFrame();
- // Constructor
- virtual ~TEtchedFrame();
- // Destructor
-
- virtual void Draw(TView* itsView,
- const VRect& /*area*/);// override
- };
-
-
- //----------------------------------------------------------------------------------------
- // class TSlowScroller
- //----------------------------------------------------------------------------------------
-
- class TSlowScroller : public TScroller
- {
- MA_DECLARE_CLASS;
-
- public:
- TSlowScroller();
- // Constructor
- virtual ~TSlowScroller();
- // Destructor
-
- virtual VCoordinate ScrollStep(VHSelect vhs, short partCode); // override
- };
-
- //----------------------------------------------------------------------------------------
- // class TRoundView
- //----------------------------------------------------------------------------------------
-
- class TRoundView : public TControl
- {
- MA_DECLARE_CLASS;
-
- public:
- TRoundView();
- // Constructor
- virtual ~TRoundView();
- // Destructor
-
- virtual void Draw(const VRect& area);
- // Image it
-
- virtual void GetExtentRegion(RgnHandle itsExtentRgn); // override
- };
-
-
- #endif // __UDEMODIALOGS__
-